package com.lonwan.demo.util;

import com.lonwan.demo.vo.CommonResult;
import com.lonwan.demo.vo.RespCode;

/**
 * @author susc
 * @title: ResultHelper
 * @projectName knife4j-demo
 * @description: 返回实体构造类
 * @date 2021/9/299:52
 */
public class ResultHelper {

    public static<T> CommonResult success(String msg){
        return success(msg, "");
    }

    public static<T> CommonResult success(String msg, T data){
        CommonResult<T> result = new CommonResult<>(RespCode.SUCCESS, msg, data);
        return result;
    }

    public static <T> CommonResult error(String msg){
        return error(msg, null);
    }
    public static <T> CommonResult error(String msg, T data){
        CommonResult<T> result = new CommonResult<>(RespCode.ERROR, msg, data);
        return result;
    }

}
